from django.urls import path, re_path

from articles import views
from rest_framework import routers

router = routers.DefaultRouter()
# 注册全文搜索到视图集中生成url路由信息
router.register("search", views.CourseSearchViewSet, basename="course-search")

urlpatterns = [
    path('add/', views.ArticleAPIView.as_view()),
    path('upload/', views.UploadImgView.as_view()),
    re_path('list/(?P<user_id>\d+)/', views.ArticleListView.as_view()),
    re_path('upload/(?P<pk>\d+)/', views.ArticleUpdateSerializer.as_view()),
    path('all/', views.AllArticleListView.as_view()),
    re_path('delete/(?P<pk>\d+)/', views.ArticleDeleteView.as_view()),
    re_path('some/(?P<pk>\d+)/', views.AddSomeArticleView.as_view()),
    re_path('comment/(?P<article_id>\d+)/', views.CommentView.as_view()),
    re_path('add_comment/', views.AddCommentView.as_view()),
    path('del/', views.DeleteCommentView.as_view()),
    path('hot_word/', views.ShowHotWordView.as_view()),

] + router.urls
